﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="dodajOrgan.aspx.cs" Inherits="STS.Pacjent.dodajOrgan" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Label ID="Label1" runat="server" Text="Label" Visible="False"></asp:Label>
<br />
<br />
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
    DataKeyNames="id_organu" DataSourceID="SqlDataSource1" DefaultMode="Insert" 
    Height="50px" Width="125px">
    <Fields>
        <asp:BoundField DataField="id_organu" HeaderText="id_organu" 
            InsertVisible="False" ReadOnly="True" SortExpression="id_organu" />
        <asp:BoundField DataField="typ" HeaderText="typ" SortExpression="typ" />
        <asp:BoundField DataField="grupa_krwi" HeaderText="grupa_krwi" 
            SortExpression="grupa_krwi" />
        <asp:BoundField DataField="wiek" HeaderText="wiek" SortExpression="wiek" />
        <asp:TemplateField HeaderText="HLA_A" SortExpression="HLA_A">
            <EditItemTemplate>
                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("HLA_A") %>'></asp:TextBox>
            </EditItemTemplate>
            <InsertItemTemplate>
                <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("HLA_A") %>' 
                    Text="TAK" />
            </InsertItemTemplate>
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text='<%# Bind("HLA_A") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="HLA_B" SortExpression="HLA_B">
            <EditItemTemplate>
                <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("HLA_B") %>'></asp:TextBox>
            </EditItemTemplate>
            <InsertItemTemplate>
                <asp:CheckBox ID="CheckBox2" runat="server" Checked='<%# Bind("HLA_B") %>' 
                    Text="TAK" />
            </InsertItemTemplate>
            <ItemTemplate>
                <asp:Label ID="Label2" runat="server" Text='<%# Bind("HLA_B") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="HLA_DR" SortExpression="HLA_DR">
            <EditItemTemplate>
                <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("HLA_DR") %>'></asp:TextBox>
            </EditItemTemplate>
            <InsertItemTemplate>
                <asp:CheckBox ID="CheckBox3" runat="server" Checked='<%# Bind("HLA_DR") %>' 
                    Text="TAK" />
            </InsertItemTemplate>
            <ItemTemplate>
                <asp:Label ID="Label3" runat="server" Text='<%# Bind("HLA_DR") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="id_osrodka" HeaderText="id_osrodka" 
            SortExpression="id_osrodka" Visible="False" />
        <asp:BoundField DataField="PRA" HeaderText="PRA" SortExpression="PRA" />
        <asp:CommandField ShowInsertButton="True" />
    </Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:MGRConnectionString %>" 
    DeleteCommand="DELETE FROM [organ] WHERE [id_organu] = @id_organu" 
    InsertCommand="INSERT INTO [organ] ([typ], [grupa_krwi], [wiek], [HLA_A], [HLA_B], [HLA_DR], [id_osrodka], [PRA]) VALUES (@typ, @grupa_krwi, @wiek, @HLA_A, @HLA_B, @HLA_DR, @id_osrodka, @PRA)" 
    SelectCommand="SELECT * FROM [organ]" 
    
    UpdateCommand="UPDATE [organ] SET [typ] = @typ, [grupa_krwi] = @grupa_krwi, [wiek] = @wiek, [HLA_A] = @HLA_A, [HLA_B] = @HLA_B, [HLA_DR] = @HLA_DR, [id_osrodka] = @id_osrodka, [PRA] = @PRA WHERE [id_organu] = @id_organu">
    <DeleteParameters>
        <asp:Parameter Name="id_organu" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="typ" Type="String" />
        <asp:Parameter Name="grupa_krwi" Type="String" />
        <asp:Parameter Name="wiek" Type="Int32" />
        <asp:Parameter Name="HLA_A" Type="String" />
        <asp:Parameter Name="HLA_B" Type="String" />
        <asp:Parameter Name="HLA_DR" Type="String" />
        <asp:ControlParameter ControlID="Label1" Name="id_osrodka" PropertyName="Text" 
            Type="Int32" />
        <asp:Parameter Name="PRA" Type="Double" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="typ" Type="String" />
        <asp:Parameter Name="grupa_krwi" Type="String" />
        <asp:Parameter Name="wiek" Type="Int32" />
        <asp:Parameter Name="HLA_A" Type="String" />
        <asp:Parameter Name="HLA_B" Type="String" />
        <asp:Parameter Name="HLA_DR" Type="String" />
        <asp:Parameter Name="id_osrodka" Type="Int32" />
        <asp:Parameter Name="PRA" Type="Double" />
        <asp:Parameter Name="id_organu" Type="Int32" />
    </UpdateParameters>
</asp:SqlDataSource>
    <br />
</asp:Content>
